import org.junit.*;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * Created by IntelliJ IDEA.
 * User: Awake
 * Date: 31.01.12
 * Time: 22:29
 * To change this template use File | Settings | File Templates.
 */
public class CalcTest {

    @Test
    public void testAddRight() {
        long result = Calc.operation(2, 3, "+");
        assertTrue(result == 5);
    }

    @Test
    public void testAddWrong() {
        long result = Calc.operation(1, 3, "+");
        assertFalse(result == 5);
    }

    @Test
    public void testMinusRight() {
        long result = Calc.operation(1, 143, "-");
        assertTrue(result == -142);
    }

    @Test
    public void testMinusWrong() {
        long result = Calc.operation(101, 143, "-");
        assertFalse(result == -142);
    }

    @Test
    public void testDivisionRight() {
        long result = Calc.operation(99, 33, "/");
        assertTrue(result == 3);
    }

    @Test
    public void testDivisionWrong() {
        long result = Calc.operation(141, 143, "/");
        assertFalse(result == -1);
    }

    @Test
    public void testMultiplyRight() {
        long result = Calc.operation(8, 4, "*");
        assertTrue(result == 32);
    }

    @Test
    public void testMultiplyWrong() {
        long result = Calc.operation(9, 3, "*");
        assertFalse(result == 28);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testInvalidOperation() {
        long result = Calc.operation(1, 3, "%");
    }

    @Test(expected = IllegalArgumentException.class)
    public void testDivisionByZero() {
        long result = Calc.operation(94, 0, "/");
    }

}

